package fic.storefinder.shared;

import java.util.HashMap;

import fic.storefinder.shared.utils.Constants;

@SuppressWarnings("serial")
public class StoreFinderServiceExceptionJson extends
		StoreFinderServiceException {

	public StoreFinderServiceExceptionJson(String message, int errorCode) {
		super(message, errorCode);
		
	}

	@Override
	public String getFormattedMessage() throws Exception {
		HashMap<String, Object> response = new HashMap<String, Object>();
		HashMap<String, Object> retValue = new HashMap<String, Object>();
		HashMap<String, Object> error = new HashMap<String, Object>();
		
		
		error.put(Constants.JSON_KEY_ERRORCODE, this.getErrorCode());
		error.put(Constants.JSON_KEY_ERRORMESSAGE, this.getMessage());
		//error.put(Constants.JSON_KEY_STACKTRACE, Utils.getStringFromStackTrace(this));
		
		response.put(Constants.JSON_KEY_ERROR, error);
		response.put(Constants.JSON_KEY_CONTAINS_ERROR, new Boolean(true));
		retValue.put(Constants.JSON_KEY_RESPONSE, response);
		
		org.json.JSONObject jsonObject = new org.json.JSONObject(retValue);
		return jsonObject.toString();
	}
	
	

}
